****************************************************************************************
****************************************************************************************
** TABLE 1
****************************************************************************************
****************************************************************************************
use "${path}research_clusters_data_table.dta", clear
global productivity_lab "nb_researchers nb_units prop_biblio npubs_agg tcs_agg np_if_3y_agg  biologie_f   chimie_f physique_tot_f sciences_ingenieur_f mathematiques_f SHS_f note_totale note_1 note_2 note_3 note_4 note_5 note_6 note_7"
local tabnom  "descriptives_lab"
eststo overall: quietly estpost summarize ///
     $productivity_lab     
eststo domestic: quietly estpost summarize ///
     $productivity_lab   if accepted == 1   
eststo foreign: quietly estpost summarize ///
    $productivity_lab   if accepted == 0   
eststo diff: quietly estpost ttest ///
   $productivity_lab, by(accepted) unequal
esttab  domestic foreign   diff  , ///
mtitles("Treated" "Non Treated"  "Difference t-test") ///
cells("mean(pattern(1 1 0 ) fmt(2)) sd(pattern(1 1 0)) b(pattern(0 0 1 ) fmt(2)) p(pattern(0 0 1 ) par fmt(2))") label
set more off
esttab   domestic foreign   diff   using `tabnom'.tex, replace ///
mtitles("Treated" "Non Treated"  "Difference t-test") ///
cells("mean(pattern(1 1 0 ) fmt(2)) sd(pattern(1 1 0)) b(pattern(0 0 1 ) fmt(2)) p(pattern(0 0 1 ) par fmt(2))") label
